<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />


    <link href="/static/v5/static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="/static/v5/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/static/v5/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link href="/static/v5/static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
    <link href="/static/v5/static/h-ui.admin/css/style.css" rel="stylesheet" type="text/css" />
    <link href="/static/v5/lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="/static/v5/css/kkpager_blue.css" />
    <title>权限管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 权限管理 <span class="c-gray en">&gt;</span> 管理员管理 <span class="c-gray en">&gt;</span> 管理员列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">


    <th:block  th:each="funcion, funcionStat: ${funcions.obj.sonFuncion}">
        <div th:if="${funcion.func_name == '添加'}">
            <a th:href="${funcion.link_url + '?token='  + token}" >
                <button type="submit" class="btn btn-success radius" id="" name="">
                    <i class="Hui-iconfont">&#xe600;</i>添加
                </button>
            </a>
        </div>
    </th:block>
    <div class="mt-20">
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th class="head0" width="5%">id</th>
                <th class="head0" width="10%">名称</th>
                <th class="head0" width="10%">手机号码</th>
                <th class="head0" width="10%">角色</th>
                <th class="head0" width="10%">最后登录时间</th>
                <th class="head0" width="10%">最后登录ip</th>
                <th class="head0" width="10%">添加时间</th>
                <th class="head0" width="10%">操作</th>
            </tr>
            </thead>
            <div th:if="${retInfo.mark == '0'}">
                <tbody >
                <th:block  th:each="admin, adminStat: ${retInfo.obj.admins}">
                    <tr class="text-c" id="table">
                        <td th:text="${admin.admin_id}"></td>
                        <td th:text="${admin.user_name}"></td>
                        <td th:text="${admin.phone}"></td>
                        <td th:text="${admin.role_name}"></td>
                        <td th:text="${#dates.format(admin.login_time, 'yyyy-MM-dd')}"></td>
                        <td th:text="${admin.login_ip}" ></td>
                        <td th:text="${#dates.format(admin.reg_time, 'yyyy-MM-dd')}"></td>
                        <td class="td-manage">
                            <th:block  th:each="funcion, funcionStat: ${funcions.obj.sonFuncion}">
                                    <a th:if="${funcion.func_name == '更新'}"  th:href="${funcion.link_url + admin.admin_id + '&token='  + token}">更新</a>
                                    <a th:if="${funcion.func_name == '删除'}" href="###"  th:onclick="|deleteAdmin( ${admin.admin_id})|">删除</a>
                            </th:block>
                        </td>
                    </tr>
                </th:block>
                </tbody>
            </div>

        </table>
        <div th:if="${retInfo.mark != '0'}">

            暂无管理员
        </div>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/static/v5/lib/jquery/1.9.1/jquery.min.js"></script>
<!--<script type="text/javascript" src="${ctx}/resource/lib/layer/2.4/layer.js"></script>-->
<!--<script type="text/javascript" src="${ctx}/resource/static/h-ui/js/H-ui.min.js"></script>-->
<!--<script type="text/javascript" src="${ctx}/resource/static/h-ui.admin/js/H-ui.admin.js"></script> &lt;!&ndash;/_footer 作为公共模版分离出去&ndash;&gt;-->
<script type="text/javascript" src="/static/v5/js/kkpager.js"></script>
<div th:if="${retInfo.mark == '0'}">
    <div style="margin: 0px 20px 0px 20px">
        <div id="kkpager"></div>
    </div>
    <script  th:inline="javascript">
        //init
        $(function() {
            /*<![CDATA[*/
            var totalPage = [[${retInfo.obj.total_page}]];
            var totalRecords = [[${retInfo.obj.total_record}]];
            var pageNo = [[${retInfo.obj.current_page}]];
            var page_size = [[${retInfo.obj.page_size}]];
            var father_id = [[${retInfo.obj.father_id}]];
            /*]]>*/
            if(!pageNo){
                pageNo = 1;
            }
            //生成分页
            //有些参数是可选的，比如lang，若不传有默认值
            kkpager.generPageHtml({
                pno : pageNo,
                //总页码
                total : totalPage,
                //总数据条数
                totalRecords : totalRecords,

                getLink : function(n){
                    var href = "/v5/admin/accounts/list" + "?page_size=" + page_size + "&father_id="+ father_id + "&current_page=" + n + "&token="  + sessionStorage.getItem("token")
                    return href;
                }

            });
        });
    </script>
</div>
<script type="text/javascript">
    function resettingPass(admin_id) {
        var dataJson = {
            admin_id:admin_id,
            user_pass:"123456"
        }
        $.ajax({
            type: 'post',
            url: '/v5/admin/accounts/resetting/pass' + "?token="  + sessionStorage.getItem("token") ,
            dataType: 'json',
            data: JSON.stringify(dataJson),
            contentType: "application/json; charset=utf-8",
            success: function (data) {
                if (data.mark == "0") {
                    alert("重置密码成功")
                    window.location.reload();
                } else {
                    alert(data.tip);
                }
            }
        });
    }
    function deleteAdmin(admin_id){
        var dataJson = {
            admin_id:admin_id
        }
        $.ajax({
            type: 'post',
            url: '/v5/admin/accounts/delete'+ "?token="  + sessionStorage.getItem("token") ,
            dataType: 'json',
            data: JSON.stringify(dataJson),
            contentType: "application/json; charset=utf-8",
            success: function (data) {
                if (data.mark == "0") {
                    window.location.reload();
                } else {
                    alert(data.tip);
                }
            }
        });
    }
</script>
</body>
</html>

